package com.example.wechat_applet.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T>
{
	private Integer code;
	private String mes;
	private T data;

	public Result(Integer code, String mes)
	{
		this.code = code;
		this.mes = mes;
	}

	public static Result ok()
	{
		return new Result(200,"ok");
	}

	public static <T extends Comparable> T ok(T data)
	{
		return (T) new Result(200,"ok",data);
	}

	public static Result error()
	{
		return new Result(500,"error");
	}
}
